<?php

namespace app\model;

use think\Model;

class SystemFieldRandPower extends Model
{
    protected $createTime='create_date';

    public function addDataModel($param){
        return self::create($param);
    }

    public function getFieldIdData($id)
    {
        $data = $this->where(['field_id'=>$id])->findOrEmpty();
        if (!$data->isEmpty ()){
            return $data->toArray ();
        }
        return null;
    }

    public function editFieldIdData($id,$data)
    {
        $find = $this->where (['field_id'=>$id])->findOrEmpty ();
        if (!$find->isEmpty ()){
            return $this->where (['field_id'=>$id])->update ($data);
        }
        return self::create ($data);
    }

    public function delFieldIdData($id)
    {
        return $this->where (['field_id'=>$id])->delete ();
    }

}